<!--#include file="../nav/admin_top.php" -->
<div class="titleDiv">
	<div class="titleCaption">
		<span class="captionSpan">配送方式</span>
	</div>
</div>
<div class="menuBg">
	<a class="menuAdd" href="{url::build('admin_deliver','add')}">添加配送方式</a> 
  <div style="clear:both"></div>
</div>
<div style="margin:10px auto">
	搜索： 
	<select id="status" class="textBox" onchange="fnSearchs()">
		<option value="">--所有状态--</option> 
		<option value="0">停用</option> 
		<option value="1">启用</option> 
	</select>
	<input type="text" maxlength="12" id="keywords" class="searchs" /> 
	<input type="button"  onclick="fnSearchs()" value="查询"  />  	
</div> 
<div id="grids"></div> 
<script type="text/javascript">
var url_list = '/admin_deliver/index_list';
var url_modify = '/admin_deliver/modify';
var url_del = '/admin_deliver/del';
$().ready(function(){
	o2js.build('jquery_cluetip');
	o2js.build('o2grid');
	showLoading();
	grids = new o2Grid({
		bind:'grids', 
		url:url_list,
		imgpath:'/misc/vendors/o2js/o2grid/image',
		cols:[
			{index:'id',mapping:'a.id', name:'序号', width:50,sortable:false, func:function(val,row_index,column_name,json,R){
				 return  '<span title="ID：'+json.id+'" >'+((R.page - 1)*R.rowNum + (row_index+1))+'</span>';
			}}, 
			{index:'name',mapping:'a.name', name:'配送方式', width:100,func:function(val,row_index,column_name,json,R){
					return val;
				}
			},
			{index:'price_first',mapping:'a.price_first', name:'首重运费',align:"right", width:75,func:function(val,row_index,column_name,json,R){
					return val;
				}
			},
			{index:'price_xu',mapping:'a.price_xu', name:'续重运费',align:"right",width:75,func:function(val,row_index,column_name,json,R){
					return val;
				}
			},
			{index:'wfree_flag',mapping:'a.wfree_flag', name:'免运费重量规则', width:190,func:function(val,row_index,column_name,json,R){
					if(val == '1'){
						return '<span class="green">开启</span> （免运重量：'+json.wfree_val+'份）';
					}else{
						return '<span class="red">暂停</span>';
					}
				}
			},
			{index:'mfree_flag',mapping:'a.mfree_flag', name:'免运费金额规则', width:210,func:function(val,row_index,column_name,json,R){
					if(val == '1'){
						return '<span class="green">开启</span> （免运金额：'+json.mfree_val+'元）';
					}else{
						return '<span class="red">暂停</span>';
					}
				}
			},
			{index:'status',mapping:'a.status', name:'状态', width:70,func:function(val,row_index,column_name,json,R){
					if(val == '1'){
						return '<span class="green">启用</span>';
					}else{
						return '<span class="red">暂停</span>';
					}
				}
			},
			{index:'id',mapping:'a.id', name:'操作'	, width:100,sortable:false,func:function(val,row_index,column_name,json,R){
					return ' <a href="'+url_modify+'?id='+json.id+'" style="color: "  ><img src="/misc/images/edit.gif" />  修改</a> ';
				}
			}
		]
	});
	fnSearchs();	 
	$('#keywords').keypress(function(e){
		if(e.keyCode==13||e.keyCode==10){
			fnSearchs();
		}
	}); 
	
});
function fnSearchs(){
	grids.setBaseParams({
		keywords:encodeURIComponent($('#keywords').val()),
		status:$('#status').val()
	}); 
	grids.load(1); 
} 
/* 删除 */
function fnDel(NId){
	fnConfirm({
		str:'确认删除本行数据?',
		func_true:function(){
			$('button').attr('disabled','disabled');
			$.post(
				url_del,
				{
					id:NId
				},
				function(e){
					var ok = errorHandler(e);
					if(ok && ok.success=='1'){
						window.location.reload();
					}
					$('button').attr('disabled','');
				}
			);
		}
	}); 
}
</script>
<!--#include file="../nav/admin_bottom.php" -->